<?php
require_once  __DIR__ . '/includes/authenticate.php';
?>

<h2>Opponents</h2>

<div id="container-fluid">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">

<center>
  <button class="btn btn-primary hidden-print" id="viewopponentinfo" >View Opponent Info</button>
  <button class="btn btn-primary hidden-print" id="addeditopponentinfo" >Add Opponent Info</button>

</center>
<div id="subcontent"></div>

<div class="col-md-3"></div>
</div>

 </div>
 </div>

 <br>

 

<script type="text/javascript">

function myFunction() {
    window.print();
}

$("#addeditopponentinfo").on("click", function(e) {
	$.ajax({
  type: "GET",
  url: "./opponents_add.php",
  success: function(data) {
    $("#subcontent").html(data);
  },
  error: function (xhr, status, error) {
    $("#subcontent" ).html(xhr.responseText); 
  }
  }); 
  e.preventDefault();
});

$("#viewopponentinfo").on("click", function(e) {
  $.ajax({
  type: "GET",
  url: "./opponents_view.php",
  success: function(data) {
    $("#subcontent").html(data);
  },
  error: function (xhr, status, error) {
    $("#subcontent").html(xhr.responseText); 
  }
  }); 
  e.preventDefault();
});

</script>